//
//  ShowArchivViewController.m
//  记账本
//
//  Created by lirilu on 15/4/21.
//  Copyright (c) 2015年 glirlu@gmail.com. All rights reserved.
//

#import "ShowArchivViewController.h"
#import "Account.h"
#import "TableViewCell.h"

@interface ShowArchivViewController ()
@property(retain,nonatomic) NSMutableArray *AccountArray;

@end

@implementation ShowArchivViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"fileName:%@",self.archiverData.achiverFileName);
    [self.navigationController.navigationItem setTitle:self.archiverData.achiverFileName];
}

- (NSMutableArray*)AccountArray{
    if (!_AccountArray) {
        //解档
        _AccountArray = [NSKeyedUnarchiver unarchiveObjectWithFile:[Account filePath:self.archiverData.achiverFileName]];
        if (!_AccountArray) {
            _AccountArray = [[NSMutableArray alloc]init];
        }
//        [self InitData];
        
    }
    return _AccountArray;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSLog(@"count:%ld",self.AccountArray.count);
    return self.AccountArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    return [TableViewCell getCell:tableView Account:self.AccountArray[indexPath.row] delegate:nil];
}


#pragma UITabelViewDelegate

@end
